﻿#region Header

/*
Behavioral Rating of Dancing Human Crowds based on Motion Patterns
By

Pascal Hauser 
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

and

Raphael Gfeller
Dipl. Ing. in Informatik, Hochschule für Technik Rapperswil, 2006
Master Thesis, Hochschule für Technik Rapperswil, 2008-2010

*/

#endregion

#region Usings

using System.Collections.Generic;
using System.Linq;

#endregion

namespace Tests.Basics.Optimization {
	/// <summary>
	/// Description of the class
	/// </summary>
	public class DestrictiveModel {
		#region Public Properties

		// public Properties located here

		#endregion

		#region Public Methods

		public void AddParameter(string name, Parameter param) {
			if (m_parameters.ContainsKey(name)) {
				m_parameters.Remove(name);
			}
			m_parameters.Add(name, param);
		}

		public Parameter GetParameter(string name) {
			return m_parameters[name];
		}

		public void AddArgs(string name, Parameter param) {
			if (m_args.ContainsKey(name)) {
				m_args.Remove(name);
			}
			m_args.Add(name, param);
		}

		public Parameter GetArgs(string name) {
			return m_args[name];
		}

		public KeyValuePair<string, Parameter>[] GetArgs() {
			return m_args.ToArray();
		}

		public void Run() {
			m_concequences.Clear();
			foreach (_calculateConcequence fct in m_fcts) {
				fct(this);
			}
		}

		public void AddConsequenceToCalculate(_calculateConcequence fct) {
			m_fcts.Add(fct);
		}

		public void SetConcequence(string name, object value) {
			if (m_concequences.ContainsKey(name)) {
				m_concequences.Remove(name);
			}
			m_concequences.Add(name, value);
		}

		public object GetConcequence(string name) {
			return m_concequences[name];
		}

		#endregion

		#region Private Methods

		// private methods located here

		#endregion

		#region Private Fields

		private readonly Dictionary<string, Parameter> m_args = new Dictionary<string, Parameter>();
		private readonly Dictionary<string, object> m_concequences = new Dictionary<string, object>();
		private readonly List<_calculateConcequence> m_fcts = new List<_calculateConcequence>();
		private readonly Dictionary<string, Parameter> m_parameters = new Dictionary<string, Parameter>();

		#endregion
	}

	public delegate void _calculateConcequence(DestrictiveModel model);
}